package ie.dkit.semanticPhotoWeb.server.clientServerConnector;

/**
 * @author Sebastian Ruehl
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 */
public class Login {

	/**
	 * This is the basic Google Adress for authentication
	 */
	public final static String GOOGLE_AUTH_SUB_BASE_ADDR = LoginPropertiesParser.getString("Login.GOOGLE_AUTH_SUB_BASE_ADDR"); //$NON-NLS-1$

	/**
	 * (required) URL the user should be redirected to after a successful login.
	 * This value should be a page on the web application site, and can include
	 * query parameters.
	 */
	public final static String NEXT = LoginPropertiesParser.getString("Login.NEXT"); //$NON-NLS-1$

	/**
	 * (required) URL identifying the service to be accessed. The resulting
	 * token will enable access to the specified service only. Some services may
	 * limit scope further, such as read-only access.
	 */
	public final static String SCOPE = LoginPropertiesParser.getString("Login.SCOPE"); //$NON-NLS-1$

	/**
	 * (optional) Boolean flag indicating whether the authentication transaction
	 * should issue a secure token (1) or a non-secure token (0). Secure tokens
	 * are available to registered applications only.
	 */
	public final static String SECURE = LoginPropertiesParser.getString("Login.SECURE"); //$NON-NLS-1$

	/**
	 * (optional) Boolean flag indicating whether the one-time-use token may be
	 * exchanged for a session token (1) or not (0).
	 */
	public final static String SESSION = LoginPropertiesParser.getString("Login.SESSION"); //$NON-NLS-1$

	public static String getAuthURL() {
		return GOOGLE_AUTH_SUB_BASE_ADDR + "?next=" + NEXT + "&scope=" + SCOPE //$NON-NLS-1$ //$NON-NLS-2$
				+ "&secure=" + SECURE + "&session=" + SESSION; //$NON-NLS-1$ //$NON-NLS-2$
	}
}
